/* ==============================================
   主题变量
   ============================================== */
:root {
  --gradient-pink-blue: linear-gradient(135deg, #ff6a88 0%, #85fbd0 100%);
  --bg-card: rgba(255, 255, 255, 0.85);
  --glass-bg: rgba(255, 255, 255, 0.2);
  --input-bg: rgba(255, 255, 255, 0.7);
  --text: #333333;
  --text-light: #666666;
  --text-primary: #2c3e50;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  --pink: #ff6a88;
  --blue: #6a55ff;
  --accent: #00d4ff;
  --radius: 20px;
  --success: #00d4aa;
  --warning: #ff9f43;
  --danger: #ff6b6b;

  /* 新增玻璃态效果变量 */
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
  --backdrop-blur: blur(16px);
  
  /* 柔和背景色 */
  --bg-light: #fafbfc;
  --bg-secondary: #f5f7fa;
}

html[data-theme="dark"] {
  --bg-card: rgba(45, 52, 65, 0.85);
  --glass-bg: rgba(45, 52, 65, 0.3);
  --input-bg: rgba(55, 65, 81, 0.7);
  --text: #e2e8f0;
  --text-light: #94a3b8;
  --text-primary: #f1f5f9;
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  
  /* 深色模式柔和背景 */
  --bg-light: #1e293b;
  --bg-secondary: #334155;
}

/* ==============================================
   重置 & 全局布局
   ============================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 106, 136, 0.18) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(106, 85, 255, 0.15) 0%, transparent 60%),
    linear-gradient(135deg, var(--bg-light) 0%, var(--bg-secondary) 100%);
  background-size: 600px 600px, 400px 400px, 100% 100%;
  background-position: 0 0, 100% 100%, 0 0;
  animation: gradientShift 30s linear infinite;
  min-height: 100vh;
  overflow-x: hidden;
}

@keyframes gradientShift {
  0%, 100% { 
    background-position: 0 0, 100% 100%, 0 0;
  }
  25% { 
    background-position: 100% 0, 0 100%, 80% 20%, 0 0;
  }
  50% { 
    background-position: 100% 100%, 0 0, 20% 80%, 0 0;
  }
  75% { 
    background-position: 0 100%, 100% 0, 60% 40%, 0 0;
  }
}

#backgroundCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.6;
}

/* ==============================================
   主容器 - 玻璃态设计
   ============================================== */
.profile-wrapper {
  min-height: 100vh;
  padding: 2rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.profile-card {
  width: 100%;
  max-width: 480px;
  padding: 3rem 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--backdrop-blur);
  position: relative;
  overflow: hidden;
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
}

.profile-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
}

/* ==============================================
   浮动控制按钮
   ============================================== */
.btn-back,
.toggle-mode,
.toggle-gradient {
  position: fixed;
  width: 56px;
  height: 56px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--glass-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.btn-back { top: 2rem; left: 2rem; }
.toggle-mode { top: 2rem; right: 2rem; }
.toggle-gradient { top: 2rem; right: 5rem; }

.btn-back i,
.toggle-mode i,
.toggle-gradient i {
  font-size: 1.5rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.btn-back:hover,
.toggle-mode:hover,
.toggle-gradient:hover {
  transform: scale(1.1) rotate(5deg);
  background: var(--input-bg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* ==============================================
   标题 - 创新设计
   ============================================== */
.title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, var(--pink), var(--blue), var(--accent));
  background-size: 200% 200%;
  animation: gradientText 3s ease infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--pink), var(--blue));
  border-radius: 2px;
}

@keyframes gradientText {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ==============================================
   头像区域 - 3D效果
   ============================================== */
.avatar-area {
  width: 140px;
  height: 140px;
  margin: 0 auto 2.5rem;
  position: relative;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  padding: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-area::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--blue), var(--accent));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  filter: blur(20px);
}

.avatar-area:hover::before {
  opacity: 0.4;
}

#avatarPreview {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 2;
}

.avatar-area:hover #avatarPreview {
  transform: scale(1.05);
}

.edit-icon {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--success), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  z-index: 3;
}

.edit-icon:hover {
  transform: scale(1.15) rotate(10deg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.edit-icon i {
  font-size: 1.2rem;
}

/* ==============================================
   表单样式 - 现代化设计
   ============================================== */
.input-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--input-bg);
  backdrop-filter: blur(10px);
  font-size: 1rem;
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--bg-card);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(106, 85, 255, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-light);
  opacity: 0.7;
}

/* 性别选择 - 卡片式设计 */
.gender-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 0.5rem;
}

.gender-option {
  position: relative;
}

.gender-option input[type="radio"] {
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.gender-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 0;
  backdrop-filter: blur(10px);
}

.gender-option input[type="radio"]:checked + label {
  background: linear-gradient(135deg, var(--pink), var(--blue));
  color: white;
  border-color: transparent;
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.gender-option label:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

/* 个人简介样式 */
#bio {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
}

.bio-counter {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  font-weight: 500;
}

.bio-counter.warning { color: var(--warning); }
.bio-counter.danger { color: var(--danger); }

/* ==============================================
   按钮样式 - 渐变动画
   ============================================== */
.btn {
  width: 100%;
  padding: 1rem 2rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  background-size: 200% 200%;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.btn:hover {
  background-position: 100% 0;
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.btn:hover::before {
  left: 100%;
}

.btn:active {
  transform: translateY(-1px);
}

/* ==============================================
   分割线
   ============================================== */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
  margin: 2.5rem 0;
  border: none;
}

/* ==============================================
   Modal 样式升级
   ============================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  z-index: 1000;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  margin: 10% auto;
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from { 
    transform: translateY(-50px);
    opacity: 0;
  }
  to { 
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.3s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  background: var(--glass-bg);
  color: var(--text);
  transform: rotate(90deg);
}

.modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

#modalAvatarPreview {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--glass-border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--blue);
  color: var(--blue);
}

.btn-outline:hover {
  background: var(--blue);
  color: white;
}

.modal-footer {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn-cancel,
.btn-primary {
  flex: 1;
  padding: 0.75rem;
}

.btn-cancel {
  background: transparent;
  border: 2px solid var(--glass-border);
  color: var(--text);
}

.btn-primary {
  background: linear-gradient(135deg, var(--success), var(--accent));
}

/* ==============================================
   Toast 通知升级
   ============================================== */
.toast-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 2000;
}

.toast {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  animation: toastSlideIn 0.3s ease, toastFadeOut 0.3s ease 2.7s;
  max-width: 350px;
  box-shadow: var(--glass-shadow);
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ==============================================
   响应式设计
   ============================================== */
@media (max-width: 768px) {
  .profile-wrapper {
    padding: 1rem;
  }
  
  .profile-card {
    padding: 2rem 1.5rem;
    margin: 1rem 0;
  }
  
  .title {
    font-size: 2rem;
  }
  
  .avatar-area {
    width: 120px;
    height: 120px;
  }
  
  .gender-group {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .btn-back,
  .toggle-mode,
  .toggle-gradient {
    top: 1rem;
    width: 48px;
    height: 48px;
  }
  
  .btn-back { left: 1rem; }
  .toggle-mode { right: 1rem; }
  .toggle-gradient { right: 4rem; }
  
  .modal-content {
    margin: 5% auto;
    width: 95%;
  }
}

/* ==============================================
   滚动条美化
   ============================================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--glass-bg);
  border-radius: 4px;
  backdrop-filter: blur(10px);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--input-bg);
}

/* ==============================================
   微交互动画
   ============================================== */
.input-group {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
  transform: translateY(20px);
}

.input-group:nth-child(1) { animation-delay: 0.1s; }
.input-group:nth-child(2) { animation-delay: 0.2s; }
.input-group:nth-child(3) { animation-delay: 0.3s; }
.input-group:nth-child(4) { animation-delay: 0.4s; }
.input-group:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 为表单添加悬浮效果 */
form {
  position: relative;
}

form::before {
  content: '';
  position: absolute;
  inset: -10px;
  background: linear-gradient(135deg, var(--pink), var(--blue), var(--accent));
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  filter: blur(20px);
}

form:hover::before {
  opacity: 0.1;
}
